#pragma once

/*-----------------------------------------------------------------*\
	
	Graphic is a container for the Renderable objects

\*-----------------------------------------------------------------*/

#include "Renderable.h"

#include <vector>
#include <set>

namespace Graphics
{
    class CompRenderable
    {
    public:
        inline bool operator()(Renderable* r1,Renderable* r2)
        {
            return r1->GetSequence() < r2->GetSequence();
        }
    };

    typedef std::vector<Renderable*> RenderContainer;
    typedef RenderContainer::iterator RenderIter;

	class Graphic
	{
	protected:

        bool m_Dirty;
        bool m_Rendering;
		RenderContainer m_Renders;

	public:
		Graphic(void);
		virtual ~Graphic(void) = 0;

	public:
		// call every Renderable object's Render() in m_RenderHash,
		// by the sequence of GetSequence() value.
		bool RenderAll(void);

		// add a Renderable object to render list
		Renderable& Add(Renderable& obj);

		// remove the Renderable object from render list
		void Remove(Renderable& iter);

        void MarkDirty();
	};
}